//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#ifndef __ELASTOS_PREELOCK_H__
#define __ELASTOS_PREELOCK_H__

class PreemptionLock
{
public:
    void Lock();

    void Unlock();

private:
    bool_t  m_bOriginalPreemption;
};

INLINE void PreemptionLock::Lock()
{
    m_bOriginalPreemption = DzDisablePreemption();
}

INLINE void PreemptionLock::Unlock()
{
    DzRestorePreemption(m_bOriginalPreemption);
}

#endif //__ELASTOS_PREELOCK_H__
